<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>提现</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> 
		<link href="__INDEX__/store/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="__INDEX__/store/css/style.css" />
		<link rel="stylesheet" href="__INDEX__/store/css/newsj.css" />
	</head>

	<body class="sjindexcon">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">提现</h1>
		</header>
		<div class="mui-content sjindexcon">
			<div class="tix_numbox">
				<div>提现额度</div>
				<div class="tix_num">
					<label>¥</label>
					<input type="text" placeholder="输入提现金额" style="font-size: 1.2rem;" onkeyup="clearNoNums(this)" id="tixian_money" autocomplete="off" />
				</div>
				<div class="tips">当前钱包余额：<em id="yue"><?php  echo substr($agent_info['balance'],0,strlen($agent_info['balance'])-2);?></em></div>
			</div>
			<div class="tix_numbox">
				<div>实际到账</div>
				<div class="tix_num">
					<label>¥</label>
					<input type="number" placeholder="0" id="tmuch" autocomplete="off" style="font-size: 1.2rem;" />
				</div> 
			</div>
			<div class="btnbox2" style="text-align:center;margin-top: 15px;" onclick="submit_tx()"><button type="button" class="dzyhq_btn">提现</button></div>
			<div class="tuig_tips3">申请提现成功后，该笔提现T+1到账银行卡。</div>
		</div>

	</body>

</html>

<script type="text/javascript" src="__INDEX__/store/js/mui.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/jquery.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/layer/layer.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/castapp.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/date.js"></script>
<script>
function clearNoNums(obj)
	{
		obj.value = obj.value.replace(/[^\d]/g, ""); //清除“数字”和“.”以外的字符
		obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字而不是.
		obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的.
		obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
	   	$("#tmuch").val(parseFloat(obj.value));
	}
function submit_tx(){ 
		var tixian_money =$("#tixian_money").val();
		var yue=$("#yue").text(); 
		if(tixian_money ==""){
			layer.msg("请输入提现金额");
			return false;
		}
		if(parseFloat(tixian_money) > parseFloat(yue)){
			layer.msg("余额不足");
			return false;
		}
		if(parseFloat(tixian_money)<10){
			layer.msg("提现金额不能小于10元");
			return false;
		}
		
		var obj = $('input:radio[name="type"]:checked').val();
		$.ajax({
				type:'post',
				url:"{:url('agent/yue_tixian')}" ,
				data: {
					tixian_money	: tixian_money
				},
				success: function(data) {
					if(data.code == 200) {
						layer.msg(data.msg, {
						  time: 2000 
						}, function(){
							window.location.href = "{:url('agent/yue_record')}";
						});
						
					}else{
						layer.msg(data.msg);
						console.log(data.msg);
					}
				}
			})
				
}
</script>
